var React = require('react');
var AppView = require('../../common/component/view/app-view.node');
var ModalDialog = require('../../common/component/dialog/modal-dialog.node');
var ModalBody = require('../../common/component/dialog/modal-body.node');
var ModalFooter = require('../../common/component/dialog/modal-footer.node');

module.exports = <>
  <AppView viewTitle="${t('ui.infrastructure.profile.title.profileManagement')}">

    <div className="x-search-bar">
      <form>
        <div className="form-row align-items-center">
          <div className="col-auto">
            <label className="sr-only" htmlFor="itemCode"></label>
            <div className="input-group mb-2">
              <div className="input-group-prepend">
                <div className="input-group-text">{"${t('ui.infrastructure.profile.field.itemCode')}"}</div>
              </div>
              <input type="text" className="form-control" id="itemCode" data-x-name="searchField.itemCode"
                data-x-type="autoTrimText" />
            </div>
          </div>

          <div className="col-auto">
            <label className="sr-only" htmlFor="itemName"></label>
            <div className="input-group mb-2">
              <div className="input-group-prepend">
                <div className="input-group-text">{"${t('ui.infrastructure.profile.field.itemName')}"}</div>
              </div>
              <input type="text" className="form-control" id="itemName" data-x-name="searchField.itemName"
                data-x-type="autoTrimText" />
            </div>
          </div>

          <div className="col-auto">
            <label className="sr-only" htmlFor="itemDesc"></label>
            <div className="input-group mb-2">
              <div className="input-group-prepend">
                <div className="input-group-text">{"${t('ui.infrastructure.profile.field.itemDesc')}"}</div>
              </div>
              <input type="text" className="form-control" id="itemDesc" data-x-name="searchField.itemDesc"
                data-x-type="autoTrimText" />
            </div>
          </div>

          <div className="col-auto">
            <div className="form-check mb-2">
              <input className="form-check-input" type="checkbox" id="enableFlagOnly"
                data-x-name="searchField.enableFlagOnly" data-x-type="checkbox-boolean" />
              <label className="form-check-label" htmlFor="enableFlagOnly">
                {"${t('ui.infrastructure.profile.queryField.enableFlagOnly')}"}
              </label>
            </div>
          </div>

          {/* 查询按钮 */}
          <div className="col-auto">
            <button type="button" className="btn btn-primary mb-2" data-x-ui="searchBtn">
              {"${t('ui.system.common.btn.search')}"}
            </button>
          </div>
        </div>
      </form>
    </div>

    <div className="x-tool-bar">
      <button type="button" className="btn btn-outline-primary mb-2 btn-sm" data-x-ui="createBtn" hidden>
        {"${t('ui.system.common.btn.create')}"}
      </button>
    </div>

    <table data-x-ui="profileTable" className="x-table-custom">
      <thead>
        <tr>
          <th data-field="id" data-visible="false">ID</th>
          <th data-field="itemCode">{"${t('ui.infrastructure.profile.field.itemCode')}"}</th>
          <th data-field="itemName">{"${t('ui.infrastructure.profile.field.itemName')}"}</th>
          <th data-field="itemDesc">{"${t('ui.infrastructure.profile.field.itemDesc')}"}</th>
          <th data-field="enableFlagDesc">{"${t('ui.system.common.field.enableFlag')}"}</th>
          <th>{"${t('ui.system.common.field.operate')}"}</th>
        </tr>
      </thead>
    </table>

    {/* "新建系统参数"弹出框 */}
    <div data-x-ui="newProfileDialog" className="modal" tabIndex="-1">
      <ModalDialog dialogTitle="${t('ui.infrastructure.profile.dialog.newProfile')}">
        <ModalBody>
          <form>
            <div className="form-group x-form-required">
              <label htmlFor="itemCode">{"${t('ui.infrastructure.profile.field.itemCode')}"}</label>
              <input type="text" className="form-control" id="itemCode" name="itemCode" data-x-name="new.itemCode"
                placeholder={"${t('ui.system.common.placeholder.inputCodeLimitLength', 1, 50)}"} />
            </div>
            <div className="form-group x-form-required">
              <label htmlFor="itemName">{"${t('ui.infrastructure.profile.field.itemName')}"}</label>
              <input type="text" className="form-control" id="itemName" name="itemName" data-x-name="new.itemName"
                placeholder={"${t('ui.system.common.placeholder.inputTextLimitLength', 1, 100)}"} />
            </div>
            <div className="form-group">
              <label htmlFor="itemDesc">{"${t('ui.infrastructure.profile.field.itemDesc')}"}</label>
              <input type="text" className="form-control" id="itemDesc" name="itemDesc" data-x-name="new.itemDesc"
                placeholder={"${t('ui.system.common.placeholder.inputTextLimitLength', 0, 200)}"} />
            </div>
            <div className="form-group">
              <label htmlFor="enableFlag">{"${t('ui.system.common.field.enableFlag')}"}</label>
              <select className="form-control" id="enableFlag" name="enableFlag" data-x-name="new.enableFlag"
                defaultValue="true">
                <option value="true">{"${t('ui.system.common.option.enableFlag.true')}"}</option>
                <option value="false">{"${t('ui.system.common.option.enableFlag.false')}"}</option>
              </select>
            </div>
          </form>
        </ModalBody>
        <ModalFooter confirmLabel="${t('ui.system.common.btn.save')}" cancelLabel="${t('ui.system.common.btn.cancel')}" />
      </ModalDialog>
    </div>

    {/* "编辑系统参数"弹出框 */}
    <div data-x-ui="editProfileDialog" className="modal" tabIndex="-1">
      <ModalDialog dialogTitle="${t('ui.infrastructure.profile.dialog.editProfile')}">
        <ModalBody>
          <form>
            <input type="hidden" id="id" name="id" data-x-name="edit.id" />
            <input type="hidden" id="versionNumber" name="versionNumber" data-x-name="edit.versionNumber" />

            <div className="form-group x-form-required">
              <label htmlFor="itemCode">{"${t('ui.infrastructure.profile.field.itemCode')}"}</label>
              <input type="text" className="form-control" id="itemCode" name="itemCode" data-x-name="edit.itemCode"
                placeholder={"${t('ui.system.common.placeholder.inputCodeLimitLength', 1, 50)}"} />
            </div>
            <div className="form-group x-form-required">
              <label htmlFor="itemName">{"${t('ui.infrastructure.profile.field.itemName')}"}</label>
              <input type="text" className="form-control" id="itemName" name="itemName" data-x-name="edit.itemName"
                placeholder={"${t('ui.system.common.placeholder.inputTextLimitLength', 1, 100)}"} />
            </div>
            <div className="form-group">
              <label htmlFor="itemDesc">{"${t('ui.infrastructure.profile.field.itemDesc')}"}</label>
              <input type="text" className="form-control" id="itemDesc" name="itemDesc" data-x-name="edit.itemDesc"
                placeholder={"${t('ui.system.common.placeholder.inputTextLimitLength', 0, 200)}"} />
            </div>
            <div className="form-group">
              <label htmlFor="enableFlag">{"${t('ui.system.common.field.enableFlag')}"}</label>
              <select className="form-control" id="enableFlag" name="enableFlag" data-x-name="edit.enableFlag"
                defaultValue="true">
                <option value="true">{"${t('ui.system.common.option.enableFlag.true')}"}</option>
                <option value="false">{"${t('ui.system.common.option.enableFlag.false')}"}</option>
              </select>
            </div>
          </form>
        </ModalBody>
        <ModalFooter confirmLabel="${t('ui.system.common.btn.save')}" cancelLabel="${t('ui.system.common.btn.cancel')}" />
      </ModalDialog>
    </div>

    <script src="${appJs('app/infrastructure/profile/profile-management.js')}" type="text/javascript"></script>
  </AppView>
</>
